<template>
  <router-link style="margin-right: 10px;" replace to="/">首页</router-link>
  <router-link style="margin-right: 10px;" replace to="/login">登录</router-link>
  <router-link style="margin-right: 10px;" to="/register">注册</router-link>
  <router-link style="margin-right: 10px;" to="/user">用户中心</router-link>

  <button @click="router.push(toPath)">导航</button><input type="text" v-model="toPath" >

  <router-view v-slot:default="{ Component }">
    <keep-alive :exclude="['index']">
      <component :is="Component" />
    </keep-alive>
  </router-view>
  <hr>
  <router-view name="user2" />
</template>

<script setup lang='ts'>
import { ref, reactive, onActivated } from 'vue'
import { useRouter } from 'vue-router';
const router = useRouter()
const toPath = ref('/')

</script>

<style lang='scss' scoped>

</style>